﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Cobit5.Web.Cobit
{
    public partial class GoalITRetrieve : System.Web.UI.Page
    {
        public int goalITId;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.goalITId = int.Parse(Request.QueryString["id"].ToString());
            }
            catch
            {
                Response.Redirect("GoalITList.aspx");
            }

            if (BIZ.Cobit.GoalIT.ExistGoalIT(goalITId) == 0)
                Response.Redirect("GoalITList.aspx");

            FillGoalITData(this.goalITId);
        }

        protected void FillGoalITData(int in_id)
        {
            BIZ.Cobit.GoalIT myGoalIT = new BIZ.Cobit.GoalIT(in_id);
            Label_Id.Text = myGoalIT.id.ToString();
            Label_DescriptionCHN.Text = myGoalIT.descriptionCHN;
            Label_Description.Text = myGoalIT.description;
            Label_RelatedMetricCHN.Text = myGoalIT.relatedMetricCHN;
            Label_RelatedMetric.Text = myGoalIT.relatedMetric;
        }

        protected void Button_Update_Click(object sender, EventArgs e)
        {
            Response.Redirect("GoalITUpdate.aspx?id=" + goalITId.ToString());
        }

        protected void Button_Delete_Click(object sender, EventArgs e)
        {
            Response.Redirect("GoalITDelete.aspx?id=" + goalITId.ToString());
        }
    }
}